package kafka;

import net.sf.json.JSONObject;
import util.DateUtil;

import java.util.*;

/**
 * USER: lintc 【lintiancong@zhuojianchina.com】
 * DATE: 2017-07-11 09:56
 */
public class LogMap {
    private String timeStr = DateUtil.dateToString(new Date(), "yyyy-MM-dd");

    private Map<String, List<JSONObject>> logMap = new HashMap<>();

    public void setLog(String time, JSONObject log) {
        List<JSONObject> ary = logMap.get(time);
        if (ary == null) {
            ary = new ArrayList<>();
        }
        ary.add(log);
        logMap.put(time, ary);
        timeStr = time;
    }

    public void clean(String time) {
        logMap.remove(time);
    }

    public List<JSONObject> getList(String time) {
        return logMap.get(time);
    }

    public String getTimeStr() {
        return timeStr;
    }

    public void setTimeStr(String timeStr) {
        this.timeStr = timeStr;
    }

    public Map<String, List<JSONObject>> getLogMap() {
        return logMap;
    }

    public void setLogMap(Map<String, List<JSONObject>> logMap) {
        this.logMap = logMap;
    }
}
